//
//  DDEasyScrollCard.h
//  Dada
//
//  Created by 搭搭 on 2022/3/23.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class DDEasyScrollCard;


/**
 * 数据协议
 */
@protocol DDEasyScrollCardDataSource <NSObject>

@required
/**
 * 需要展示overlap(重叠的个数)
 */
- (NSInteger)overlapCountOfEasyScrollCard:(DDEasyScrollCard*)card;

/**
 * 需要展示的数据，要传入URL地址的字符串数组
 */
- (NSArray<NSString*>*)cardListOfEasyScrollCard:(DDEasyScrollCard*)card;

@optional

/**
 * 是否可以循环滚动 默认为true
 */
- (BOOL)canLoopScrollOfEasyScrollCard:(DDEasyScrollCard*)card;

/**
 * 图片垂直偏移的顶部距离 默认为10
 */
- (CGFloat)imageRowMarginOfEasyScrollCard:(DDEasyScrollCard*)card;
/**
 * 图片水平偏移的距离 默认为10
 */
- (CGFloat)imageLineMarginOfEasyScrollCard:(DDEasyScrollCard*)card;

/**
 * 滑动距离相当于自身宽度多少的时候算做一次滑动 默认0.4
 */
- (CGFloat)panMinMarginScaleOfEasyScrollCard:(DDEasyScrollCard*)card;

/**
 * 滑动结束时候 执行滑动的最低速度 默认值为200
 */
- (CGFloat)panMinVelocityValueOfEasyScrollCard:(DDEasyScrollCard*)card;

/**
 * 图片在最顶层时候的圆角 默认为24
 */
- (CGFloat)imageMaxCornerRadiusOfEasyScrollCard:(DDEasyScrollCard*)card;
/**
 * 图片在最底层时候的圆角 默认为16
 */
- (CGFloat)imageMinCornerRadiusOfEasyScrollCard:(DDEasyScrollCard*)card;


@end


/**
 * 其他事件协议
 */
@protocol DDEasyScrollCardDelegate <NSObject>

@optional

/**
 * 点击了card的回调
 * @param index 当前显示的主图下标
 */
- (void)easyCard:(DDEasyScrollCard*_Nonnull)easyCard itemClickWithIndex:(NSInteger)index;

/**
 * 将要开始滑动的时候的回调
 * @param index 当前显示的主图下标
 */
- (void)easyCard:(DDEasyScrollCard*_Nonnull)easyCard willBeginScrollWithIndex:(NSInteger)index;

/**
 * 将近结束的时候的回调
 * @param fromIndex 来自哪个数组下标
 * @param toIndex 下一个展示的数据下标
 */
- (void)easyCard:(DDEasyScrollCard*_Nonnull)easyCard willEndScrollFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex;

@end


@interface DDEasyScrollCard : UIView

/// 数据协议代理
@property (nonatomic,weak)id<DDEasyScrollCardDataSource>dataSource;
/// 其他代理
@property (nonatomic,weak)id<DDEasyScrollCardDelegate>delegate;

@end

NS_ASSUME_NONNULL_END
